1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module shumate.SimpleMap; 26 27 private import glib.ConstructionException; 28 private import gobject.ObjectG; 29 private import gtk.AccessibleIF; 30 private import gtk.AccessibleT; 31 private import gtk.BuildableIF; 32 private import gtk.BuildableT; 33 private import gtk.ConstraintTargetIF; 34 private import gtk.ConstraintTargetT; 35 private import gtk.Widget; 36 private import shumate.Compass; 37 private import shumate.Layer; 38 private import shumate.LicenseSh; 39 private import shumate.MapSource; 40 private import shumate.Scale; 41 private import shumate.Viewport; 42 private import shumate.c.functions; 43 public import shumate.c.types; 44 45 46 /** 47 * A ready-to-use map [class@Gtk.Widget].If you want to use your own implementation, 48 * you can look at the [class@Shumate.Map] widget. 49 * 50 * The simple map contains a zoom widget, a [class@Shumate.License] at the bottom, 51 * a [class@Shumate.Scale] and a [class@Shumate.Compass]. 52 */ 53 public class SimpleMap : Widget 54 { 55 /** the main Gtk struct */ 56 protected ShumateSimpleMap* shumateSimpleMap; 57 58 /** Get the main Gtk struct */ 59 public ShumateSimpleMap* getSimpleMapStruct(bool transferOwnership = false) 60 { 61 if (transferOwnership) 62 ownedRef = false; 63 return shumateSimpleMap; 64 } 65 66 /** the main Gtk struct as a void* */ 67 protected override void* getStruct() 68 { 69 return cast(void*)shumateSimpleMap; 70 } 71 72 /** 73 * Sets our main struct and passes it to the parent class. 74 */ 75 public this (ShumateSimpleMap* shumateSimpleMap, bool ownedRef = false) 76 { 77 this.shumateSimpleMap = shumateSimpleMap; 78 super(cast(GtkWidget*)shumateSimpleMap, ownedRef); 79 } 80 81 82 /** */ 83 public static GType getType() 84 { 85 return shumate_simple_map_get_type(); 86 } 87 88 /** */ 89 public this() 90 { 91 auto __p = shumate_simple_map_new(); 92 93 if(__p is null) 94 { 95 throw new ConstructionException("null returned by new"); 96 } 97 98 this(cast(ShumateSimpleMap*) __p); 99 } 100 101 /** 102 * Adds a map layer as an overlay on top of the base map. 103 * 104 * Params: 105 * layer = a [class@Layer] to add 106 */ 107 public void addOverlayLayer(Layer layer) 108 { 109 shumate_simple_map_add_overlay_layer(shumateSimpleMap, (layer is null) ? null : layer.getLayerStruct()); 110 } 111 112 /** 113 * Gets the compass widget for the map. 114 * 115 * Returns: a [class@Compass] 116 */ 117 public Compass getCompass() 118 { 119 auto __p = shumate_simple_map_get_compass(shumateSimpleMap); 120 121 if(__p is null) 122 { 123 return null; 124 } 125 126 return ObjectG.getDObject!(Compass)(cast(ShumateCompass*) __p); 127 } 128 129 /** 130 * Gets the license widget for the map. 131 * 132 * Returns: a [class@License] 133 */ 134 public LicenseSh getLicense() 135 { 136 auto __p = shumate_simple_map_get_license(shumateSimpleMap); 137 138 if(__p is null) 139 { 140 return null; 141 } 142 143 return ObjectG.getDObject!(LicenseSh)(cast(ShumateLicense*) __p); 144 } 145 146 /** 147 * Gets the map source for the current base layer. 148 * 149 * Returns: a [class@MapSource] 150 */ 151 public MapSource getMapSource() 152 { 153 auto __p = shumate_simple_map_get_map_source(shumateSimpleMap); 154 155 if(__p is null) 156 { 157 return null; 158 } 159 160 return ObjectG.getDObject!(MapSource)(cast(ShumateMapSource*) __p); 161 } 162 163 /** 164 * Gets the scale widget for the map. 165 * 166 * Returns: a [class@Scale] 167 */ 168 public Scale getScale() 169 { 170 auto __p = shumate_simple_map_get_scale(shumateSimpleMap); 171 172 if(__p is null) 173 { 174 return null; 175 } 176 177 return ObjectG.getDObject!(Scale)(cast(ShumateScale*) __p); 178 } 179 180 /** 181 * Gets whether or not the zoom buttons are shown. 182 * 183 * Returns: %TRUE if the zoom buttons are visible, otherwise %FALSE 184 */ 185 public bool getShowZoomButtons() 186 { 187 return shumate_simple_map_get_show_zoom_buttons(shumateSimpleMap) != 0; 188 } 189 190 /** 191 * Gets the map's viewport, needed for constructing map layers that will be added 192 * to it. 193 * 194 * Returns: a [class@Viewport] 195 */ 196 public Viewport getViewport() 197 { 198 auto __p = shumate_simple_map_get_viewport(shumateSimpleMap); 199 200 if(__p is null) 201 { 202 return null; 203 } 204 205 return ObjectG.getDObject!(Viewport)(cast(ShumateViewport*) __p); 206 } 207 208 /** */ 209 public void insertOverlayLayer(Layer layer, uint idx) 210 { 211 shumate_simple_map_insert_overlay_layer(shumateSimpleMap, (layer is null) ? null : layer.getLayerStruct(), idx); 212 } 213 214 /** 215 * Removes a layer from the map. 216 * 217 * Params: 218 * layer = a [class@Layer] that was added to the map previously 219 */ 220 public void removeOverlayLayer(Layer layer) 221 { 222 shumate_simple_map_remove_overlay_layer(shumateSimpleMap, (layer is null) ? null : layer.getLayerStruct()); 223 } 224 225 /** 226 * Sets the source for the base map. 227 * 228 * Params: 229 * mapSource = a [class@MapSource] 230 */ 231 public void setMapSource(MapSource mapSource) 232 { 233 shumate_simple_map_set_map_source(shumateSimpleMap, (mapSource is null) ? null : mapSource.getMapSourceStruct()); 234 } 235 236 /** 237 * Sets whether or not the zoom buttons are shown. 238 * 239 * Params: 240 * showZoomButtons = %TRUE to show the zoom buttons, %FALSE to hide them 241 */ 242 public void setShowZoomButtons(bool showZoomButtons) 243 { 244 shumate_simple_map_set_show_zoom_buttons(shumateSimpleMap, showZoomButtons); 245 } 246 }